```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RabbitMQ 消息中间件全面指南</title>
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', Georgia, 'Times New Roman', Times, serif;
            font-weight: 600;
        }
        .hero {
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
        }
        .card {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .code-block {
            background-color: #1e1e2d;
            color: #f8fafc;
            border-left: 4px solid #8b5cf6;
        }
        .mermaid {
            background-color: white;
            border-radius: 0.5rem;
            padding: 1.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        .highlight {
            background-color: #f3e8ff;
            padding: 0.25rem 0.5rem;
            border-radius: 0.25rem;
            font-weight: 500;
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl flex flex-col items-center text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6">RabbitMQ 消息中间件</h1>
            <p class="text-xl md:text-2xl max-w-3xl mb-8 opacity-90">企业级消息队列解决方案的全面指南</p>
            <div class="flex space-x-4">
                <span class="px-4 py-2 bg-white bg-opacity-10 rounded-full flex items-center">
                    <i class="fas fa-exchange-alt mr-2"></i> 异步通信
                </span>
                <span class="px-4 py-2 bg-white bg-opacity-10 rounded-full flex items-center">
                    <i class="fas fa-bolt mr-2"></i> 高性能
                </span>
                <span class="px-4 py-2 bg-white bg-opacity-10 rounded-full flex items-center">
                    <i class="fas fa-shield-alt mr-2"></i> 可靠性
                </span>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl py-12 px-4">
        <!-- Introduction Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="bg-indigo-500 w-12 h-12 rounded-full flex items-center justify-center text-white mr-4">
                    <i class="fas fa-info-circle text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold">RabbitMQ 简介</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-question-circle mr-2"></i> 为什么需要消息中间件？
                    </h3>
                    <p class="text-gray-700 mb-4">在现代分布式系统中，应用程序间的直接调用往往导致高耦合和性能瓶颈。消息中间件通过异步通信机制解决了这些问题，提供了松耦合、可靠通信和流量削峰等优势。</p>
                    <img src="https://cdn.nlark.com/yuque/0/2022/png/21449790/1652524519295-f02d2fb8-a2a4-4b4f-bd5a-30faa97d0f72.png" alt="消息中间件架构" class="rounded-lg shadow-sm w-full">
                </div>

                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-comment-alt mr-2"></i> 什么是 MQ 及 RabbitMQ？
                    </h3>
                    <p class="text-gray-700 mb-2"><span class="highlight">MQ (Message Queue)</span> 是一种应用程序对应用程序的通信方法，通过读写队列中的消息进行通信，无需专用连接。</p>
                    <ul class="list-disc pl-5 space-y-2 text-gray-700">
                        <li>成熟产品: IBM WEBSPHERE MQ</li>
                        <li>开源产品: ActiveMQ, RabbitMQ, Kafka, RocketMQ</li>
                        <li>RabbitMQ 基于 AMQP 协议，采用 Erlang 实现</li>
                    </ul>
                    <div class="mt-4 p-4 bg-gray-50 rounded-lg">
                        <h4 class="font-medium text-gray-800 mb-2">AMQP 协议</h4>
                        <p class="text-gray-700">高级消息队列协议，为面向消息的中间件设计，不受客户端/中间件不同产品或开发语言的限制。</p>
                    </div>
                </div>
            </div>

            <!-- Mermaid Diagram -->
            <div class="mermaid mb-12">
                graph TD
                    A[Producer] -->|Publish Message| B[Exchange]
                    B -->|Route Message| C[Queue 1]
                    B -->|Route Message| D[Queue 2]
                    C --> E[Consumer 1]
                    D --> F[Consumer 2]
            </div>
        </section>

        <!-- Installation Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="bg-indigo-500 w-12 h-12 rounded-full flex items-center justify-center text-white mr-4">
                    <i class="fas fa-download text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold">RabbitMQ 安装</h2>
            </div>

            <div class="grid md:grid-cols-3 gap-6 mb-8">
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-search mr-2"></i> 搜索镜像
                    </h3>
                    <p class="text-gray-700 mb-4">使用带管理界面的版本 (3.7.17-management)</p>
                    <img src="https://cdn.nlark.com/yuque/0/2022/png/21449790/1652524519830-22f7f920-bcb0-46b3-96a3-6bb398e765fd.png" alt="搜索镜像" class="rounded-lg shadow-sm w-full">
                </div>

                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-cloud-download-alt mr-2"></i> 拉取版本
                    </h3>
                    <p class="text-gray-700 mb-4">指定版本号拉取镜像</p>
                    <img src="https://cdn.nlark.com/yuque/0/2022/png/21449790/1652524520281-8183d4b4-0519-4a85-832e-359e06231521.png" alt="拉取镜像" class="rounded-lg shadow-sm w-full">
                </div>

                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-play mr-2"></i> 启动容器
                    </h3>
                    <p class="text-gray-700 mb-4">映射管理端口和服务端口</p>
                    <img src="https://cdn.nlark.com/yuque/0/2022/png/21449790/1652524520523-08c5b3d9-34ca-4363-b045-34fa4958b33b.png" alt="启动容器" class="rounded-lg shadow-sm w-full">
                </div>
            </div>

            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="p-6">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">启动命令详解</h3>
                    <div class="code-block p-4 rounded-lg mb-4">
                        <code class="text-green-400">docker run -d --name myrabbitmq -p 15672:15672 -p 5672:5672 rabbitmq:3.7.17-management</code>
                    </div>
                    <ul class="list-disc pl-5 space-y-2 text-gray-700">
                        <li><span class="font-medium">-d</span>: 后台运行</li>
                        <li><span class="font-medium">--name</span>: 设置容器名称</li>
                        <li><span class="font-medium">-p 15672</span>: 管理端口映射</li>
                        <li><span class="font-medium">-p 5672</span>: 服务端口映射</li>
                    </ul>
                </div>
                <div class="bg-gray-50 px-6 py-4 border-t border-gray-200">
                    <p class="text-gray-700">访问管理界面: <span class="text-indigo-600">http://[your-ip]:15672/</span> (用户名: guest/guest)</p>
                </div>
            </div>
        </section>

        <!-- Java Operation Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="bg-indigo-500 w-12 h-12 rounded-full flex items-center justify-center text-white mr-4">
                    <i class="fab fa-java text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold">Java 操作 RabbitMQ</h2>
            </div>

            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="p-6">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600">添加依赖</h3>
                    <div class="code-block p-4 rounded-lg">
                        <pre>&lt;dependency&gt;
    &lt;groupId&gt;com.rabbitmq&lt;/groupId&gt;
    &lt;artifactId&gt;amqp-client&lt;/artifactId&gt;
    &lt;version&gt;5.4.3&lt;/version&gt;
&lt;/dependency&gt;</pre>
                    </div>
                </div>
            </div>

            <!-- Simple Mode -->
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-paper-plane mr-2"></i> 简单模式 - 消息提供者
                    </h3>
                    <div class="code-block p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre>// 1.连接RabbitMQ
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("192.168.189.137"); // 连接地址
factory.setPort(5672); // 设置端口号
factory.setUsername("guest");
factory.setPassword("guest");
factory.setVirtualHost("/"); // 配置虚拟主机
Connection connection = factory.newConnection();// 创建连接

// 2.获取channel对象
Channel channel = connection.createChannel();
// 3.创建队列
channel.queueDeclare("myqueue",false,false,false,null);
// 4.发送消息
String msg = "hello 中文 2";
channel.basicPublish("","myqueue",null,msg.getBytes("utf-8"));
// 5.断开连接
connection.close();</pre>
                    </div>
                </div>

                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-inbox mr-2"></i> 简单模式 - 消息消费者
                    </h3>
                    <div class="code-block p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre>// 工具类抽取
public class ConnectionUtils {
    private static ConnectionFactory factory = null;
    static {
        factory = new ConnectionFactory();
        factory.setHost("192.168.189.137");
        factory.setPort(5672);
        factory.setUsername("guest");
        factory.setPassword("guest");
        factory.setVirtualHost("/");
    }
    public static Connection getConnection(){
        // 实现连接获取...
    }
}

// 消费者
Connection connection = ConnectionUtils.getConnection();
Channel channel = connection.createChannel();
channel.queueDeclare("myqueue",false,false,false,null);
channel.basicConsume("myqueue",true,new DefaultConsumer(channel){
    @Override
    public void handleDelivery(String consumerTag, Envelope envelope, 
        AMQP.BasicProperties properties, byte[] body) {
        System.out.println("消费者:"+new String(body,"utf-8"));
    }
});</pre>
                    </div>
                </div>
            </div>

            <!-- Work Mode -->
            <div class="card bg-white p-6 rounded-xl shadow-md mb-8">
                <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                    <i class="fas fa-users mr-2"></i> Work 模式
                </h3>
                <p class="text-gray-700 mb-4">Work模式和简单模式类似，区别在于它有多个消费者<mark class="bg-red-100 text-red-800">交替</mark>获取队列中的内容。</p>
                <div class="bg-blue-50 p-4 rounded-lg border border-blue-100">
                    <p class="text-blue-800"><i class="fas fa-info-circle mr-2"></i> 实现方式：复制一个消费者变两个消费者即可。</p>
                </div>
            </div>

            <!-- Fanout Mode -->
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-broadcast-tower mr-2"></i> Fanout模式 - 消息提供者
                    </h3>
                    <div class="code-block p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre>Connection connection = ConnectionUtils.getConnection();
Channel channel = connection.createChannel();
// 创建交换机(fanout:广播类型)
channel.exchangeDeclare("myexchange1","fanout");
// 发送消息给交换机
String msg ="hello RabbitMQ";
channel.basicPublish("myexchange","",null,msg.getBytes("utf-8"));
connection.close();</pre>
                    </div>
                </div>

                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-satellite-dish mr-2"></i> Fanout模式 - 消息消费者
                    </h3>
                    <div class="code-block p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre>// 消费者1
Connection connection = ConnectionUtils.getConnection();
Channel channel = connection.createChannel();
channel.queueDeclare("queue1",false,false,false,null);
channel.queueBind("queue1","myexchange1","");
channel.basicConsume("queue1",true,new DefaultConsumer(channel){
    @Override
    public void handleDelivery(...) {
        System.out.println("consumer1:"+new String(body,"utf-8"));
    }
});

// 消费者2类似，只需更换队列名</pre>
                    </div>
                </div>
            </div>

            <!-- Thread Pool -->
            <div class="card bg-white p-6 rounded-xl shadow-md mb-8">
                <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                    <i class="fas fa-tasks mr-2"></i> 线程池并发消费消息
                </h3>
                <div class="code-block p-4 rounded-lg overflow-x-auto">
                    <pre>private static ExecutorService executorService = 
    Executors.newFixedThreadPool(10);

channel.basicConsume("myqueue",true,new DefaultConsumer(channel){
    @Override
    public void handleDelivery(...) {
        executorService.submit(() -> {
            System.out.println("消费者:"+new String(body,"utf-8"));
            Thread.sleep(2000);
        });
    }
});</pre>
                </div>
            </div>
        </section>

        <!-- SpringBoot Section -->
        <section>
            <div class="flex items-center mb-8">
                <div class="bg-indigo-500 w-12 h-12 rounded-full flex items-center justify-center text-white mr-4">
                    <i class="fas fa-leaf text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold">SpringBoot 集成 RabbitMQ</h2>
            </div>

            <div class="card bg-white p-6 rounded-xl shadow-md mb-8">
                <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                    <i class="fas fa-cog mr-2"></i> 配置与依赖
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-medium text-gray-800 mb-2">添加依赖</h4>
                        <div class="code-block p-4 rounded-lg">
                            <pre>&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-amqp&lt;/artifactId&gt;
&lt;/dependency&gt;</pre>
                        </div>
                    </div>
                    <div>
                        <h4 class="font-medium text-gray-800 mb-2">配置属性</h4>
                        <div class="code-block p-4 rounded-lg">
                            <pre>spring.rabbitmq.host=192.168.189.137
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
spring.rabbitmq.virtual-host=/</pre>
                        </div>
                    </div>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-exchange-alt mr-2"></i> 创建队列和交换机
                    </h3>
                    <div class="code-block p-4 rounded-lg overflow-x-auto">
                        <pre>@Configuration
public class RabbitMQConfig {

    @Bean
    public Queue getSearchQueue() {
        return new Queue("search_queue");
    }

    @Bean
    public Queue getItemQueue(){
        return new Queue("item_queue");
    }

    @Bean
    public FanoutExchange getFanoutExchange(){
        return new FanoutExchange("goods_exchange");
    }

    @Bean
    public Binding getBinding1(){
        return BindingBuilder.bind(getSearchQueue())
               .to(getFanoutExchange());
    }

    @Bean
    public Binding getBinding2(){
        return BindingBuilder.bind(getItemQueue())
               .to(getFanoutExchange());
    }
}</pre>
                    </div>
                </div>

                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-paper-plane mr-2"></i> 发送消息
                    </h3>
                    <div class="code-block p-4 rounded-lg overflow-x-auto">
                        <pre>@Autowired
private RabbitTemplate rabbitTemplate;

@Override
public int add(Goods goods) {
    int i = goodsMapper.insertSelective(goods);
    
    // 发送消息给交换机
    rabbitTemplate.convertAndSend(
        "goods_exchange",  // 交换机名称
        "",                // 路由键
        goods              // 消息体
    );
    
    return i;
}</pre>
                    </div>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-search mr-2"></i> 同步到索引库
                    </h3>
                    <div class="code-block p-4 rounded-lg overflow-x-auto">
                        <pre>@Component
public class MyRabbitMQListener {
    @Autowired
    private ISearchService searchService;

    @RabbitListener(queues = "search_queue")
    public void goodsSyncToSolr(Goods goods){
        searchService.addGoods(goods);
    }
}</pre>
                    </div>
                </div>

                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-600 flex items-center">
                        <i class="fas fa-file-code mr-2"></i> 生成静态页面
                    </h3>
                    <div class="code-block p-4 rounded-lg overflow-x-auto">
                        <pre>@Component
public class MyRabbitListener {
    @Reference
    private IGoodsService goodsService;

    @RabbitListener(queues = "item_queue")
    public void createItemPage(Goods goodsParam) {
        Goods goods = goodsService.getById(goodsParam.getId());
        // 生成静态页面的逻辑...
    }
}</pre>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true
            }
        });
    </script>
</body>
</html>
```